package manong.mapper;

import manong.beans.Teaching;
import manong.beans.TeachingQuery;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.session.RowBounds;

import java.util.List;
@Mapper
public interface TeachingMapper {
   
    long countByExample(TeachingQuery example);

    
    int deleteByExample(TeachingQuery example);

   
    @Delete({
        "delete from teaching",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

   
    @Insert({
        "insert into teaching (class_id, teacher_id, ",
        "sem_id, class_name, ",
        "techer_name, sign, ",
        "statu, mark)",
        "values (#{classId,jdbcType=INTEGER}, #{teacherId,jdbcType=INTEGER}, ",
        "#{semId,jdbcType=INTEGER}, #{className,jdbcType=VARCHAR}, ",
        "#{techerName,jdbcType=VARCHAR}, #{sign,jdbcType=VARCHAR}, ",
        "#{statu,jdbcType=INTEGER}, #{mark,jdbcType=VARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(Teaching record);

   
    int insertSelective(Teaching record);

   
    List<Teaching> selectByExampleWithRowbounds(TeachingQuery example, RowBounds rowBounds);

  
    Teaching selectOneByExample(TeachingQuery example);

    
    List<Teaching> selectByExample(TeachingQuery example);

 
    @Select({
        "select",
        "id, class_id, teacher_id, sem_id, class_name, techer_name, sign, statu, mark",
        "from teaching",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("manong.mapper.TeachingMapper.BaseResultMap")
    Teaching selectByPrimaryKey(Integer id);

 
    int updateByExampleSelective(@Param("record") Teaching record, @Param("example") TeachingQuery example);

   
    int updateByExample(@Param("record") Teaching record, @Param("example") TeachingQuery example);

   
    int updateByPrimaryKeySelective(Teaching record);

  
    @Update({
        "update teaching",
        "set class_id = #{classId,jdbcType=INTEGER},",
          "teacher_id = #{teacherId,jdbcType=INTEGER},",
          "sem_id = #{semId,jdbcType=INTEGER},",
          "class_name = #{className,jdbcType=VARCHAR},",
          "techer_name = #{techerName,jdbcType=VARCHAR},",
          "sign = #{sign,jdbcType=VARCHAR},",
          "statu = #{statu,jdbcType=INTEGER},",
          "mark = #{mark,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Teaching record);

   
    int insertOrUpdate(Teaching record);

    
    int insertOrUpdateSelective(Teaching record);

    
    int batchInsert(@Param("list") List<Teaching> list);

   
    int batchInsertSelective(@Param("list") List<Teaching> list, @Param("selective") Teaching.Column ... selective);
}